package com.chat.xx.controller;

import com.chat.xx.beam.common.Message;
import com.chat.xx.beam.entity.UserEntity;
import com.chat.xx.beam.vo.add.UserAdd;
import com.chat.xx.beam.vo.query.UserLoginVo;
import com.chat.xx.server.UserServer;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping(value = "/user")
public class UserController {
    private final UserServer userServer;

    public UserController(UserServer userServer) {
        this.userServer = userServer;
    }
    @PostMapping("/add")
    public Message<UserEntity> addUser(@RequestBody UserAdd user) throws IllegalAccessException {
        return userServer.add(user);
    }
    @PostMapping("/login")
    public Message<UserEntity> login(@RequestBody UserLoginVo user){
        return userServer.login(user);
    }
    @GetMapping("/outLogin")
    public Message<Boolean> out(@RequestParam Integer u_id){
        return userServer.outLogin(u_id);
    }
}
